package com.zhanglijie.theory.guardsuspension;

import java.util.concurrent.LinkedBlockingDeque;

/**
 * @author zhanglijie
 * @version 1.0
 * @since 1.1.0 2022/8/11 0011 1:11
 */
public class RequestQueue2 {
    private LinkedBlockingDeque<Request> queue = new LinkedBlockingDeque<>(100);//LinkedBlockingDeque这个不行 会拿空


    /**
     * 生产者执行
     * @param request
     */
    public   void putRequest(Request request) throws InterruptedException {
        queue.put(request);
    }

    /**
     * 消费者执行
     */
    public   Request getRequest() throws InterruptedException {
        return queue.take();
    }
}
